package DemoText;

/**
 * 提莫攻击
 */
public class LeetCode495 {
    public int findPoisonedDuration(int[] nums, int target) {
        int sum = 0;
        for (int i = 1; i < nums.length; i++) {
            if (nums[i] - nums[i - 1] < target) sum += nums[i] - nums[i - 1];
            else sum += target;
        }
        return sum + target;
    }
}
